module.exports = function (mongoose, Schema, ObjectId) {
  let invitationSchema = new Schema({
    code: {
      type: String,
      required: true
    },
    inviter: {
      type: ObjectId,
      ref: 'User',
      required: true
    },
    invitee: {
      type: ObjectId,
      ref: 'User'
    },
    invitedAt: {
      type: Date
    },
    createdAt: {
      type: Date,
      default: Date.now
    }
  })

  return mongoose.model('Invitation', invitationSchema)
}
